﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SCRUM.Core.DataProviders;
using SCRUM.Core.BusinessObjects;

namespace SCRUM.Core.DAO
{
    /// <summary>
    /// Static access object for handling release
    /// </summary>
    public static class DAORelease
    {
        /// <summary>
        /// Creates the specified release.
        /// </summary>
        /// <param name="release">The specific release.</param>
        /// <param name="projectId">Release is in project</param>
        public static Release CreateNewRelease(Release release, int projectId)
        {
            return ProviderFactory.Provider.CreateRelease(release, projectId);
        }

        /// <summary>
        /// Updates the specified release.
        /// </summary>
        /// <param name="release">The specific release.</param>
        /// <param name="projectId">Release is in project</param>
        public static void UpdateRelease(Release release, int projectId)
        {
            ProviderFactory.Provider.UpdateRelease(release, projectId);
        }

        /// <summary>
        /// Deletes the specified release.
        /// </summary>
        /// <param name="release">The specific release.</param>
        public static void DeleteRelease(Release release)
        {
            ProviderFactory.Provider.DeleteRelease(release.ID);
        }

        /// <summary>
        /// Deletes the specified release ID.
        /// </summary>
        /// <param name="releaseID">The specific release ID.</param>
        public static void DeleteRelease(int releaseID)
        {
            ProviderFactory.Provider.DeleteRelease(releaseID);
        }

        /// <summary>
        /// Returns release according to its id
        /// </summary>
        /// <param name="releaseId">ID of the release.</param>
        /// <returns>Release based on ID.</returns>
        public static Release GetReleaseById(int releaseId)
        {
            return ProviderFactory.Provider.GetReleaseById(releaseId);
        }

        /// <summary>
        /// Gets the release by sprintID.
        /// </summary>
        /// <param name="sprintID">ID of the sprint.</param>
        public static Release GetReleaseBySprintID(int sprintID)
        {
            return ProviderFactory.Provider.GetReleaseBySprintID(sprintID);
        }

        /// <summary>
        /// Gets all releases for project.
        /// </summary>
        /// <param name="projectID">All releases in project with this id</param>
        /// <returns>List with all releases for the project.</returns>
        public static IList<Release> GetAllReleasesForProject(int projectID)
        {
            return ProviderFactory.Provider.GetAllReleasesForProject(projectID);
        }

        /// <summary>
        /// Method without parameter gets all releases
        /// </summary>
        /// <returns>all releases</returns>
        public static IList<Release> GetAllReleases()
        {
            return ProviderFactory.Provider.GetAllReleases();
        }

        public static IList<Release> GetAllReleases(int projectID, int releaseID, int sprintID, string name, string version)
        {
            return ProviderFactory.Provider.GetAllReleases(projectID, releaseID, sprintID, name, version);
        }      
    }
}
